package com.capgemini.simpleappblanche.utils;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;


public interface GenericDao<E,K> {
	
	/**
     * Find an entity by its primary key
     *
     * @param id the primary key
     * @return the entity
     */
    E findById(final K id);

    /**
     * Load all entities.
     *
     * @return the list of entities
     */
    List<E> findAll();

    E persist(E entity);
    
	E merge(final E entity);
	
    void remove(E entity);
    
    String getEntityName();
    
    EntityManager getEntityManager();
    
    E singleResultOrNull(final TypedQuery<E> query);
}

